# Maintainer: Zach Bacon <11doctorwhocanada@gmail.com>

_realname=faac
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.29.7.8
pkgrel=1
pkgdesc="FAAC is an AAC audio encoder (mingw-w64)"
arch=('any')
url='http://www.audiocoding.com/faac.html'
license=('GPL2')
source=("https://downloads.sourceforge.net/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('316fff598764b93485dc5fb41379768b8c69348bbbb87e0e30ce28b1da487251')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}

  autoreconf -fiv
}

build() {
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-static \
    --enable-shared \
    --without-mp4v2

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
}
